package com.atguigu.tingshu.order.enumeration;

import com.atguigu.tingshu.common.constant.SystemConstant;

public enum PayWayEnum {
    // 支付方式枚举项，建立对应关系
    ORDER_PAY_WAY_WEIXIN(SystemConstant.ORDER_PAY_WAY_WEIXIN , "微信") ,
    ORDER_PAY_WAY_ALIPAY(SystemConstant.ORDER_PAY_WAY_ALIPAY , "支付宝") ,
    ORDER_PAY_ACCOUNT(SystemConstant.ORDER_PAY_ACCOUNT , "余额") ;

    PayWayEnum(String payWay, String payWayName){
        this.payWay = payWay;
        this.payWayName = payWayName;
    }

    private String payWay;
    private String payWayName;

    public static String getPayWayEnum(String payWay) {
        PayWayEnum[] payWayEnums = PayWayEnum.values();
        for (PayWayEnum payWayEnum : payWayEnums) {
            if(payWayEnum.payWay.equals(payWay)){
                return payWayEnum.payWayName;
            }
        }
        return "";
    }
}
